import  React  from 'react';
//Homechidlren
import homeChild from './homeChildren';
//接口
import {Iprops} from '../utils/interface';
//一级
const Main = React.lazy(()=>import('../view/main'));
const Login = React.lazy(()=>import('../view/login'));
const Topic = React.lazy(()=>import('../view/detail/topic'));
const Brand = React.lazy(()=>import('../view/detail/brand'));
const Addcart = React.lazy(()=>import('../view/addcart'));
const Adress = React.lazy(()=>import('../view/adress'));
const Collect = React.lazy(()=>import('../view/collect'));
const Leave = React.lazy(()=>import('../view/leave'));
const Search = React.lazy(()=>import('../view/search'));
const Addtoadr = React.lazy(()=>import('../view/addtoadr'));
const Category = React.lazy(()=>import('../view/detail/category'));
const Page404 = React.lazy(()=>import('../view/Page404'))


const config = {
    routes:[
        {
            path:'/main',
            component:Main,
            children:homeChild
        },
        {
            path:'/login',
            component:Login
        },
        {
            path:'/topicDetail/:id',
            component:Topic
        },
        {
            path:'/brandDetail/:id',
            component:Brand
        },
        {
            path:'/addcart/:id',
            component:Addcart
        },
        {
            path:'/adress',
            component:Adress
        },
        {
            path:'/collect',
            component:Collect
        },
        {
            path:'/leave',
            component:Leave
        },
        {
            path:'/search',
            component:Search
        },
        {
            path:'/addtoadr',
            component:Addtoadr
        },
        {
            path:'/category/:id',
            component:Category
        },
        {
            path:'/404',
            component:Page404
        },
        {
            path:'/',
            redirect:'/main'
        },
        {
            path:'*',
            redirect:'/404'
        },
    ]
}

export default config as Iprops
